<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>
<div class="middle padtop10 myclear">
	
	<form name="frmSignUp" id="frmSignUp" action="" method="post" >
		<div class="page-content">
		
		<!-- bread crumb -->
		<p id="bread-crumb">
			<a href="<?php echo base_url();?>">
				<?php echo $lang['home']?>
			</a>
			<a href="<?php echo site_url('user');?>">
				<?php echo $lang['user']?>
			</a>
			<?php echo $lang['create_user']?>
		</p><!-- end bread crumb -->
		
		<h3>
			<?php echo $lang['create_user']?>
		</h3>
		<br style="clear:both;" />
		<div class="register-page" style="width:50%;float:left;">
			
			<p class="login-label">
				<?php echo $lang['username']?>: <span class="require">*</span>
			</p>
			<p class="padbottom2">
				<input type="text" class="login-input <?php if($errUser!='') echo 'error-border';?>" name="username" id="username" value="<?php echo $username?>" />
			</p>
			<p class="padtop5 padbottom5 error-text" id="errorUsername" ><?php echo $errUser;?></p>
			
			<p class="login-label padtop5">
				<?php echo $lang['password']?>: <span class="require">*</span>
			</p>
			<p class="padbottom2">
				<input type="password" class="login-input <?php if($errPass!='') echo 'error-border';?>" name="password" id="password" />
			</p>
			
			<p class="login-label padtop5">
				<?php echo $lang['re_password']?>: <span class="require">*</span>
			</p>
			<p class="padbottom2">
				<input type="password" class="login-input" name="repassword" id="repassword" />
			</p>
			<p class="padtop5 padbottom5 error-text" id="errorPassword" ><?php echo $errPass?></p>
			
			<p class="login-label padtop5">
				<?php echo $lang['fullname']?>: <span class="require">*</span>
			</p>
			<p class="padbottom2">
				<input type="text" class="login-input <?php if($errName!='') echo 'error-border';?>" name="fullname" id="fullname" value="<?php echo $fullname?>" />
			</p>
			<p class="padtop5 padbottom5 error-text" id="errorFullname"><?php echo $errName?></p>
			
			<p class="login-label padtop5">
				<?php echo $lang['email']?>: <span class="require">*</span>
			</p>
			<p class="padbottom2">
				<input type="text" class="login-input <?php if($errEmail!='') echo 'error-border';?>" name="email" id="email" value="<?php echo $email?>" />
			</p>
			<p class="padtop5 padbottom5 error-text" id="errorEmail"><?php echo $errEmail?></p>
			
			<p class="login-label padtop5">
				<?php echo $lang['phone']?>: <span class="require">*</span>
			</p>
			<p class="padbottom2">
				<input type="text" class="login-input <?php if($errPhone!='') echo 'error-border';?>" name="phone" id="phone" value="<?php echo $phone?>" />
			</p>
			<p class="padtop5 padbottom5 error-text" id="errorPhone" ><?php echo $errPhone?></p>
			
			<p class="login-label padtop5">
				<?php echo $lang['address']?>:
			</p>
			<p class="padbottom2">
				<input type="text" class="login-input" name="address" id="address" value="<?php echo $address?>" />
			</p>
			
		</div>
		<div style="width:48%;float:right">
			<p class="login-label padtop5">
				<?php echo $lang['role']?>:
			</p>
			<p class="padbottom2">
				<select name="roleid" id="roleid" onchange="disableSelectSale();">
                    <?php foreach ($lang['arr_role'] as $val=>$key){?>
						<?php if($val == -7){?>
						<?php } else {?>
                        <option value="<?php echo $val;?>" <?php if($role==$val) echo 'selected="selected"'?>><?php echo $key;?></option>
                        <?php }?>
                    <?php }?>
				</select>
			</p>
			
			<p class="login-label padtop5">
				<?php echo $lang['block']?>? : &nbsp;<input type="checkbox" name="block" value="1" <?php if($block==1) echo 'checked=true'?> />
			</p>
			<p class="login-label padtop5">
				<?php echo $lang['active']?>? : &nbsp;<input type="checkbox" name="active" value="1" <?php if($active==1) echo 'checked=true'?> />
			</p>
		</div>
		
		<br style="clear:both;" /><br />
		<p class="respage-btn-box myclear">
			<input type="submit" value="<?php echo $lang['create']?>"></input>
			<input type="button" onclick="window.location.href='<?php echo site_url('user');?>';" value="<?php echo $lang['cancel'];?>"></input>
		</p>
		<br />
	</div> <!-- end page content -->
	</form>
</div>
<script type="text/javascript">
function getSaler()
{
	var groupid = $('#groupid').val();
	var img = $('#img_loading');
	$(img).show();
	$.ajax({
		url: '<?php echo site_url('user/ajaxGetSaleInGroup')?>/?groupid=' + groupid,
		success: function(data){
			$(img).hide();
			$('#saleid').html(data);
		}
	});
}
function disableSelectSale()
{
	var roleid = $('#roleid').val();
	if(roleid == '3' || roleid == '4')
		$('#saleid').removeAttr('disabled');
	else
	{
		issale = $('#saleid');
		$(issale).val(0);
		$(issale).attr('disabled', 'disabled');
	}
}
$(document).ready(function(){
	disableSelectSale();
});
</script>